public class Main {
    public static void main(String[] args) {
        //饿汉单例
        System.out.println("--------------饿汉------------");
        EagerSingletonFactory.getInstance().setMyName("rainkaze");
        System.out.println(EagerSingletonFactory.getInstance().shoInfo());

        System.out.println(EagerSingletonFactory.getInstance().shoInfo());

        System.out.println(EagerSingletonFactory.getInstance().getMyName());


        System.out.println("--------------懒汉------------");
        //懒汉单例
        System.out.println(LazySingletonFactory.getInstance().shoInfo());

        System.out.println(LazySingletonFactory.getInstance().shoInfo());


    }
}